home *** CD-ROM | disk | FTP | other *** search
- Path: news.dadd.ti.com!newsmgrs@dadd.ti.com
- From: Sudheer Vemulapalli <sudheer@dadd.ti.com>
- Newsgroups: comp.lang.c
- Subject: renaming file names from within C!
- Date: 16 Jan 1996 22:12:27 GMT
- Organization: Texas Instruments
- Message-ID: <4dh7sb$6de@hammerhead.dadd.ti.com>
- NNTP-Posting-Host: roadrunner.dadd.ti.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (X11; I; SunOS 5.3 sun4m)
- X-URL: news:comp.lang.c
-
- Hello Netters,
-
- I have a question. Please let me know how to do the following.
-
- How can i move/rename a file in the UNIX system from within a C program.
-
- Suppose i have two strings "a" and "b".
-
- char *a, *b;
-
- which contain the two strings. and let's say that a file exists with its name
- same as the string in "b". How can i rename it or mv it so that the file's name
- becomes same as string in "a".
-
- Is there a short way of doing it rather than creating another file with new
- name and copying the contents of the old file into the new file and then
- removing the old file.
-
- Thankx in advance.
-
- Bye,
- --
- Sudheer K. Vemulapalli
-
-